﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;


namespace ATM
{
    public partial class Electricity : Form
    {
       // PayBillDB billDB = new PayBillDB();
        PayBillLogic billlogic = new PayBillLogic();
        string accountnum, accountnum2;
      
        string elec = "Electricity";
        public Electricity(string acc)
        {
            InitializeComponent();
            accountnum = acc;
        }
        private void show_Click(object sender, EventArgs e)
        {
            accountnum2 = accountnum;
            PayBillLogic.grid = dataGridView1;

            billlogic.showbillcall(elec, accountnum2);
        }
        private void pay_pill_Click(object sender, EventArgs e)
        {

            accountnum2 = accountnum;

            billlogic.paybillcall(elec, accountnum2);
            if (billlogic.checkbill == 1)
            {
                billlogic.add_t_balnce(accountnum2);
                this.Hide();
                inter_face frm = new inter_face(accountnum2);// byraga3ny tany lel interface b3d matak  button deposit
                frm.Show();
            }
            else if (billlogic.checkbill == 0)
            {
                MessageBox.Show("Your balance isn't enough to pay this bill or you have no bill right now sir");
                this.Hide();
                inter_face frm2 = new inter_face(accountnum2);// byraga3ny tany lel interface b3d matak  button deposit
                frm2.Show();
            }
        }

        private void exit_Click(object sender, EventArgs e)
        {
            welcom w = new welcom();
            w.Show();
            this.Hide();
        }

        private void back_Click(object sender, EventArgs e)
        {
            inter_face inter = new inter_face(accountnum);
            inter.Show();
            this.Hide();
        }
    }
}

